load('Data')

%%
Q=diag([1000 8000 0 0]);
R=0.2;
[K,S,e]=lqr(A,B,Q,R);

%%
Acl = A - B*K;
figure;
plot(eig(Acl), '*r');
hold on
xlabel('Real axis');
ylabel('Imaginary axis');
title('Poles closed-loop system');
axis([-15 1 -10 10]);
plot([0,0],[-10,10]);
plot([-15,1],[0, 0]);
hold off
